package api

import (
	"github.com/gin-gonic/gin"
	"weekly-exam/api/handler"
	"weekly-exam/api/middware"
	"weekly-exam/consts"
	"weekly-exam/pkg"
)

func LoginRunTime(r *gin.Engine) {
	r.GET("/ping", handler.Ping)
	r.Use(middware.Run())
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("login", handler.Login)
		}
		video := api.Group("/video")
		{
			video.GET("list", handler.List)
			video.Use(pkg.JwtAuth(consts.JWT_KEY))
			video.POST("videoadd", handler.Videos)

		}
		upload := api.Group("/upload")
		{
			upload.POST("upload", handler.Upload)
		}
	}

}
